let line = "000";
let s = 0;
let sum = 0;
if (line.indexOf("0") != -1) {
  let s2 = line + line;
  for (let i = 0; i < s2.length; i++) {
    if (s2[i] == "0") {
      s = 0;
    } else {
      s++;
      sum = Math.max(sum, s);
    }
  }
} else {
  console.log(line.length);
}
console.log(sum);
